export default {
	getUserOrders() {
		const db = this.database();
		const orderCol = db.collection('orders');
		return orderCol.orderBy('initTime', 'desc').get();
	},

	async createOrder({ data }) {
		const db = this.database();
		const orderCol = db.collection('orders');
		wf.getModule('reporter').report('custom', 'createOrder', {
			data,
		});

		if (data) {
			return orderCol.add(data);
		}
		return Promise.reject({});
	},
};
